﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Petroleum.Tool;
using HZH_Controls.Forms;
using Petroleum.DB.Model;
using Petroleum.Model;
using Petroleum.UC.Public;

namespace Petroleum.UC
{
    public partial class Step7Info : UserControl
    {
        //FormMain main = new FormMain();
        DepthRangeModel depthRangeModel;
        public Step7Info(DepthRangeModel depthRangeModel)
        {
            InitializeComponent();
            this.depthRangeModel = depthRangeModel;
            InitData();
        }
        void InitData()
        {
            if (depthRangeModel != null)
            {
                txtAPI.InputText = depthRangeModel.API;
                txtFunnelViscosity.InputText = depthRangeModel.FunnelViscosity;
                txtCake.InputText = depthRangeModel.Cake;
                txtPh.InputText = depthRangeModel.PH;
                txtSandContent.InputText = depthRangeModel.Sandcontent;
                txtFrictionCoefficient.InputText = depthRangeModel.Frictioncoefficient;
                txtPlasticViscosity.InputText = depthRangeModel.initial;
                txtFinal.InputText = depthRangeModel.final;
                depthRangeModel.Plastic = txtPlasticViscosity.InputText;
                txtYieldPiont.InputText = depthRangeModel.YieldPiont;
                txtSolidContent.InputText = depthRangeModel.Solidcontent;
                txtBentoniteClayConte.InputText = depthRangeModel.Bentonite;
                txtMud.InputText = depthRangeModel.Mud;
            }
        }
        private void btnOK_BtnClick(object sender, EventArgs e)
        {
            if (depthRangeModel != null)
            {
                depthRangeModel.API = txtAPI.InputText;
                depthRangeModel.FunnelViscosity = txtFunnelViscosity.InputText;
                depthRangeModel.Cake = txtCake.InputText;
                depthRangeModel.PH = txtPh.InputText;
                depthRangeModel.Sandcontent = txtSandContent.InputText;
                depthRangeModel.Frictioncoefficient = txtFrictionCoefficient.InputText;
                depthRangeModel.initial = txtInitial.InputText;
                depthRangeModel.final = txtFinal.InputText;
                depthRangeModel.Plastic = txtPlasticViscosity.InputText;
                depthRangeModel.YieldPiont = txtYieldPiont.InputText;
                depthRangeModel.Solidcontent = txtSolidContent.InputText;
                depthRangeModel.Bentonite = txtBentoniteClayConte.InputText;
                depthRangeModel.Mud = txtMud.InputText;
            }
            AlertForm alert = this.Parent as AlertForm;
            alert.Close();
        }
    }
}
